home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / xpcom / nsIAsyncOutputStream.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  10KB  |  255 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIAsyncOutputStream.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIAsyncOutputStream_h__
  6. #define __gen_nsIAsyncOutputStream_h__
  7.  
  8.  
  9. #ifndef __gen_nsIOutputStream_h__
  10. #include "nsIOutputStream.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17. class nsIOutputStreamCallback; /* forward declaration */
  18.  
  19. class nsIEventTarget; /* forward declaration */
  20.  
  21.  
  22. /* starting interface:    nsIAsyncOutputStream */
  23. #define NS_IASYNCOUTPUTSTREAM_IID_STR "10dc9c94-8aff-49c6-8af9-d7fdb7339dae"
  24.  
  25. #define NS_IASYNCOUTPUTSTREAM_IID \
  26.   {0x10dc9c94, 0x8aff, 0x49c6, \
  27.     { 0x8a, 0xf9, 0xd7, 0xfd, 0xb7, 0x33, 0x9d, 0xae }}
  28.  
  29. /**
  30.  * If an output stream is non-blocking, it may return NS_BASE_STREAM_WOULD_BLOCK
  31.  * when written to.  The caller must then wait for the stream to become
  32.  * writable.  If the stream implements nsIAsyncOutputStream, then the caller can
  33.  * use this interface to request an asynchronous notification when the stream
  34.  * becomes writable or closed (via the AsyncWait method).
  35.  *
  36.  * While this interface is almost exclusively used with non-blocking streams, it
  37.  * is not necessary that nsIOutputStream::isNonBlocking return true.  Nor is it
  38.  * necessary that a non-blocking nsIOutputStream implementation also implement
  39.  * nsIAsyncOutputStream.
  40.  */
  41. class NS_NO_VTABLE nsIAsyncOutputStream : public nsIOutputStream {
  42.  public: 
  43.  
  44.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IASYNCOUTPUTSTREAM_IID)
  45.  
  46.   /**
  47.      * This method closes the stream and sets its internal status.  If the 
  48.      * stream is already closed, then this method is ignored.  Once the stream
  49.      * is closed, the stream's status cannot be changed.  Any successful status
  50.      * code passed to this method is treated as NS_BASE_STREAM_CLOSED, which
  51.      * is equivalent to nsIInputStream::close. 
  52.      *
  53.      * NOTE: this method exists in part to support pipes, which have both an 
  54.      * input end and an output end.  If the output end of a pipe is closed, then
  55.      * reads from the input end of the pipe will fail.  The error code returned 
  56.      * when an attempt is made to read from a "closed" pipe corresponds to the
  57.      * status code passed in when the output end of the pipe is closed, which
  58.      * greatly simplifies working with pipes in some cases.
  59.      *
  60.      * @param aStatus
  61.      *        The error that will be reported if this stream is accessed after
  62.      *        it has been closed.
  63.      */
  64.   /* void closeWithStatus (in nsresult reason); */
  65.   NS_IMETHOD CloseWithStatus(nsresult reason) = 0;
  66.  
  67.   /**
  68.      * Asynchronously wait for the stream to be writable or closed.  The
  69.      * notification is one-shot, meaning that each asyncWait call will result
  70.      * in exactly one notification callback.  After the OnOutputStreamReady event
  71.      * is dispatched, the stream releases its reference to the 
  72.      * nsIOutputStreamCallback object.  It is safe to call asyncWait again from the
  73.      * notification handler.
  74.      *
  75.      * This method may be called at any time (even if write has not been called).
  76.      * In other words, this method may be called when the stream already has
  77.      * room for more data.  It may also be called when the stream is closed.  If
  78.      * the stream is already writable or closed when AsyncWait is called, then the
  79.      * OnOutputStreamReady event will be dispatched immediately.  Otherwise, the
  80.      * event will be dispatched when the stream becomes writable or closed.
  81.      * 
  82.      * @param aCallback
  83.      *        This object is notified when the stream becomes ready.
  84.      * @param aFlags
  85.      *        This parameter specifies optional flags passed in to configure
  86.      *        the behavior of this method.  Pass zero to specify no flags.
  87.      * @param aRequestedCount
  88.      *        Wait until at least this many bytes can be written.  This is only
  89.      *        a suggestion to the underlying stream; it may be ignored.  The
  90.      *        caller may pass zero to indicate no preference.
  91.      * @param aEventTarget
  92.      *        Specify NULL to receive notification on ANY thread (possibly even
  93.      *        recursively on the calling thread -- i.e., synchronously), or
  94.      *        specify that the notification be delivered to a specific event
  95.      *        target.
  96.      */
  97.   /* void asyncWait (in nsIOutputStreamCallback aCallback, in unsigned long aFlags, in unsigned long aRequestedCount, in nsIEventTarget aEventTarget); */
  98.   NS_IMETHOD AsyncWait(nsIOutputStreamCallback *aCallback, PRUint32 aFlags, PRUint32 aRequestedCount, nsIEventTarget *aEventTarget) = 0;
  99.  
  100.   /**
  101.      * If passed to asyncWait, this flag overrides the default behavior,
  102.      * causing the OnOutputStreamReady notification to be suppressed until the
  103.      * stream becomes closed (either as a result of closeWithStatus/close being
  104.      * called on the stream or possibly due to some error in the underlying
  105.      * stream).
  106.      */
  107.   enum { WAIT_CLOSURE_ONLY = 1U };
  108.  
  109. };
  110.  
  111. /* Use this macro when declaring classes that implement this interface. */
  112. #define NS_DECL_NSIASYNCOUTPUTSTREAM \
  113.   NS_IMETHOD CloseWithStatus(nsresult reason); \
  114.   NS_IMETHOD AsyncWait(nsIOutputStreamCallback *aCallback, PRUint32 aFlags, PRUint32 aRequestedCount, nsIEventTarget *aEventTarget); \
  115.  
  116. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  117. #define NS_FORWARD_NSIASYNCOUTPUTSTREAM(_to) \
  118.   NS_IMETHOD CloseWithStatus(nsresult reason) { return _to CloseWithStatus(reason); } \
  119.   NS_IMETHOD AsyncWait(nsIOutputStreamCallback *aCallback, PRUint32 aFlags, PRUint32 aRequestedCount, nsIEventTarget *aEventTarget) { return _to AsyncWait(aCallback, aFlags, aRequestedCount, aEventTarget); } \
  120.  
  121. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  122. #define NS_FORWARD_SAFE_NSIASYNCOUTPUTSTREAM(_to) \
  123.   NS_IMETHOD CloseWithStatus(nsresult reason) { return !_to ? NS_ERROR_NULL_POINTER : _to->CloseWithStatus(reason); } \
  124.   NS_IMETHOD AsyncWait(nsIOutputStreamCallback *aCallback, PRUint32 aFlags, PRUint32 aRequestedCount, nsIEventTarget *aEventTarget) { return !_to ? NS_ERROR_NULL_POINTER : _to->AsyncWait(aCallback, aFlags, aRequestedCount, aEventTarget); } \
  125.  
  126. #if 0
  127. /* Use the code below as a template for the implementation class for this interface. */
  128.  
  129. /* Header file */
  130. class nsAsyncOutputStream : public nsIAsyncOutputStream
  131. {
  132. public:
  133.   NS_DECL_ISUPPORTS
  134.   NS_DECL_NSIASYNCOUTPUTSTREAM
  135.  
  136.   nsAsyncOutputStream();
  137.  
  138. private:
  139.   ~nsAsyncOutputStream();
  140.  
  141. protected:
  142.   /* additional members */
  143. };
  144.  
  145. /* Implementation file */
  146. NS_IMPL_ISUPPORTS1(nsAsyncOutputStream, nsIAsyncOutputStream)
  147.  
  148. nsAsyncOutputStream::nsAsyncOutputStream()
  149. {
  150.   /* member initializers and constructor code */
  151. }
  152.  
  153. nsAsyncOutputStream::~nsAsyncOutputStream()
  154. {
  155.   /* destructor code */
  156. }
  157.  
  158. /* void closeWithStatus (in nsresult reason); */
  159. NS_IMETHODIMP nsAsyncOutputStream::CloseWithStatus(nsresult reason)
  160. {
  161.     return NS_ERROR_NOT_IMPLEMENTED;
  162. }
  163.  
  164. /* void asyncWait (in nsIOutputStreamCallback aCallback, in unsigned long aFlags, in unsigned long aRequestedCount, in nsIEventTarget aEventTarget); */
  165. NS_IMETHODIMP nsAsyncOutputStream::AsyncWait(nsIOutputStreamCallback *aCallback, PRUint32 aFlags, PRUint32 aRequestedCount, nsIEventTarget *aEventTarget)
  166. {
  167.     return NS_ERROR_NOT_IMPLEMENTED;
  168. }
  169.  
  170. /* End of implementation class template. */
  171. #endif
  172.  
  173.  
  174. /* starting interface:    nsIOutputStreamCallback */
  175. #define NS_IOUTPUTSTREAMCALLBACK_IID_STR "40dbcdff-9053-42c5-a57c-3ec910d0f148"
  176.  
  177. #define NS_IOUTPUTSTREAMCALLBACK_IID \
  178.   {0x40dbcdff, 0x9053, 0x42c5, \
  179.     { 0xa5, 0x7c, 0x3e, 0xc9, 0x10, 0xd0, 0xf1, 0x48 }}
  180.  
  181. class NS_NO_VTABLE nsIOutputStreamCallback : public nsISupports {
  182.  public: 
  183.  
  184.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IOUTPUTSTREAMCALLBACK_IID)
  185.  
  186.   /**
  187.  * This is a companion interface for nsIAsyncOutputStream::asyncWait.
  188.  */
  189. /**
  190.      * Called to indicate that the stream is either writable or closed.
  191.      *
  192.      * @param aStream
  193.      *        The stream whose asyncWait method was called.
  194.      */
  195.   /* void onOutputStreamReady (in nsIAsyncOutputStream aStream); */
  196.   NS_IMETHOD OnOutputStreamReady(nsIAsyncOutputStream *aStream) = 0;
  197.  
  198. };
  199.  
  200. /* Use this macro when declaring classes that implement this interface. */
  201. #define NS_DECL_NSIOUTPUTSTREAMCALLBACK \
  202.   NS_IMETHOD OnOutputStreamReady(nsIAsyncOutputStream *aStream); 
  203.  
  204. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  205. #define NS_FORWARD_NSIOUTPUTSTREAMCALLBACK(_to) \
  206.   NS_IMETHOD OnOutputStreamReady(nsIAsyncOutputStream *aStream) { return _to OnOutputStreamReady(aStream); } 
  207.  
  208. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  209. #define NS_FORWARD_SAFE_NSIOUTPUTSTREAMCALLBACK(_to) \
  210.   NS_IMETHOD OnOutputStreamReady(nsIAsyncOutputStream *aStream) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnOutputStreamReady(aStream); } 
  211.  
  212. #if 0
  213. /* Use the code below as a template for the implementation class for this interface. */
  214.  
  215. /* Header file */
  216. class nsOutputStreamCallback : public nsIOutputStreamCallback
  217. {
  218. public:
  219.   NS_DECL_ISUPPORTS
  220.   NS_DECL_NSIOUTPUTSTREAMCALLBACK
  221.  
  222.   nsOutputStreamCallback();
  223.  
  224. private:
  225.   ~nsOutputStreamCallback();
  226.  
  227. protected:
  228.   /* additional members */
  229. };
  230.  
  231. /* Implementation file */
  232. NS_IMPL_ISUPPORTS1(nsOutputStreamCallback, nsIOutputStreamCallback)
  233.  
  234. nsOutputStreamCallback::nsOutputStreamCallback()
  235. {
  236.   /* member initializers and constructor code */
  237. }
  238.  
  239. nsOutputStreamCallback::~nsOutputStreamCallback()
  240. {
  241.   /* destructor code */
  242. }
  243.  
  244. /* void onOutputStreamReady (in nsIAsyncOutputStream aStream); */
  245. NS_IMETHODIMP nsOutputStreamCallback::OnOutputStreamReady(nsIAsyncOutputStream *aStream)
  246. {
  247.     return NS_ERROR_NOT_IMPLEMENTED;
  248. }
  249.  
  250. /* End of implementation class template. */
  251. #endif
  252.  
  253.  
  254. #endif /* __gen_nsIAsyncOutputStream_h__ */
  255.